#!/usr/bin/env bash

# nacos

# https://github.com/alibaba/nacos/edit/master/config/src/main/resources/META-INF/nacos-db.sql
mysql -uroot -p$mysql_root_pwd -P$mysql_port -h$mysql_ip -e "create database nacos"
mysql -uroot -p$mysql_root_pwd -P$mysql_port -h$mysql_ip -Dnacos  <  nacos-db.sql


docker run  --name nacos -d -p 8848:8848 \
  --link mysql:mysql  \
  -e PREFER_HOST_MODE=hostname \
  -e MODE=standalone \
  -e SPRING_DATASOURCE_PLATFORM=mysql \
  -e MYSQL_SERVICE_HOST=mysql \
  -e MYSQL_SERVICE_PORT=3306 \
  -e MYSQL_SERVICE_DB_NAME=nacos \
  -e MYSQL_SERVICE_USER=root \
  -e MYSQL_SERVICE_PASSWORD=boe.123 \
  nacos/nacos-server
